<?php 
	//Open When Test
	error_reporting(E_ALL);
	
	//当前路径
	$root_path = dirname(__FILE__);
	$root_path = preg_replace('/\\\\/', '/', $root_path);
	define('ROOT_PATH', $root_path);
	
	//包含进基本函数库
	include(ROOT_PATH . '/protected/includes/fun.php');
	
	//加载配置文件
	init_site();

	//如果存在静态文件
    if(REDIRECT_URL == '/'){
    	$static_page_path = '/sites/main/' . MAIN_DOMAIN . '/html/' . LANGUAGE . '/index.html';
	}else{
    	$static_page_path = REDIRECT_URL;
    	$static_page_path = preg_replace('%(/sites/[^/]+)(.*)%', '$1/html/' . LANGUAGE . '$2', $static_page_path);
    }
    if(preg_match('/\.html$/', $static_page_path) && file_exists(ROOT_PATH . $static_page_path)){
        echo file_get_contents(ROOT_PATH . $static_page_path);
        exit;
    }
    
	if(AGENT === 'wap'){
		//wap转向
		header('Location: wap');
		exit;
	}
	
	$c = &c();

	call_user_func(array($c, ACT));
?>